export interface FormulaItem {
  tag?: string
  item: string
  count?: number
}

export interface BasicFormula {
  type: string
  result: FormulaItem | string
}

export interface CraftingShapelessFormula extends BasicFormula {
  type: "minecraft:crafting_shapeless"
  result: FormulaItem
  ingredients: Array<FormulaItem>
}

export interface CraftingShapedFormula extends BasicFormula {
  type: "minecraft:crafting_shaped"
  pattern: string[]
  result: FormulaItem
  key: Record<string, FormulaItem>
}

export interface BlastingFormula extends BasicFormula {
  type: "minecraft:blasting"
  ingredient: FormulaItem
  result: string
  experience: number
  cookingtime: number
}

export interface SmeltingFormula extends BasicFormula {
  type: "minecraft:smelting"
  ingredient: FormulaItem
  result: string
  experience: number
  cookingtime: number
}

export interface CampfireCookingFormula extends BasicFormula {
  type: "minecraft:campfire_cooking"
  ingredient: FormulaItem
  result: string
  experience: number
  cookingtime: number
}

export interface SmithingFormula extends BasicFormula {
  type: "minecraft:smithing"
  addition: FormulaItem
  base: FormulaItem
  result: FormulaItem
}

export interface StoneCuttingFormula extends BasicFormula {
  type: "minecraft:stonecutting"
  ingredients: Array<FormulaItem>
  result: string
  count: number
}

export interface SmokingFormula extends BasicFormula {
  type: "minecraft:smoking"
  experience: number
  cookingtime: number
  ingredient: FormulaItem
  result: string
}

export interface CreditShop extends BasicFormula {
  type: "creditshop"
  credit?: number
  useItem?: boolean
  ingredients?: FormulaItem[]
  result: FormulaItem
}

export type Formula = CraftingShapedFormula |
  SmeltingFormula |
  BlastingFormula |
  CraftingShapelessFormula |
  SmithingFormula |
  StoneCuttingFormula |
  CampfireCookingFormula |
  SmokingFormula |
  CreditShop